#ifndef _3761_MANAGET_H_
#define _3761_MANAGET_H_
#include <string>
#include "tcpclient.h"
#include "userbuffer.h"
#include "packet.h"
#include "loger.h"

class Controller : public TcpClient
{
public:
	UserBuffer  sendbuf;
	UserBuffer  recvbuf;
	std::string region;
	uint16_t	terminal;
	uint8_t		macaddr;
	bool		team;
	uint8_t		seq;
protected:
	Loger		loger;
	time_t		lastrecv;
	time_t		lastsend;
	time_t		lastbeat;
public:
	Controller(void);
public:
	bool checkSendTimeout(void);
	bool checkRecvTimeout(void);
	bool doRecvWork(void);
	bool doSendWork(void);
	bool checkRecvBuffer(void);
	bool sendHeatbeat(void);
	bool confirmAll(void);
	bool denyAll(void);
	bool confirmOneByOne(void);
};


#endif//_3761_MANAGET_H_
